#!/bin/bash
# this is in /usr/local/bin/tracker.sh but could be anywhere as long as
# it is executable and referenced in motion.conf
/usr/bin/logger 'MOTION'
# Lock to prevent overlapping executions of this script as motion can invoke
# it before the previous one has exited.
if [ ! -f '/tmp/tracking' ];then
  /usr/bin/logger 'TRACKING'
  sleep 1
  touch /tmp/tracking
  sudo /usr/bin/python /home/raymond/workspace/tracker/tracker.py
  /usr/bin/logger 'DONE'
  rm -f /tmp/tracking
else
  /usr/bin/logger 'SKIPPED'
fi
/usr/bin/logger 'ENDED'
